using System.Collections.Generic;

namespace Liberate.CodeGenerator
{
    public class TemplateContext : Dictionary<string, object>
    {
        public new object this[string key]
        {
            get
            {
                object obj;
                TryGetValue(key, out obj);
                return obj;
            }
            set { base[key] = value; }
        }

        public void Merge(TemplateContext context)
        {
            foreach (var pair in context)
            {
                this[pair.Key] = pair.Value;
            }
        }
    }

    public class TemplateContextCollection : List<TemplateContext>
    {
    }
}